<template>
  <div class="global-header" v-bind="$attrs" v-on="$listeners">
    <div class="left-title-area">
      <span class="title">{{ title }}</span>
    </div>
    <div class="right-action-area">
      <!-- 插槽组 -->
      <template v-for="(item, name) in $slots">
        <slot :name="name"></slot>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  inheritAttrs: false,
  name: 'SlotHeader',
  props: {
    // 关键性props存放，非关键性使用$attrs透传
    title: {
      type: String,
      default: '默认标题'
    }
  },
  data() {
    return {
   
    }
  },
}
</script>

<style lang="scss" scoped>
.global-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  .left-title-area {
    display: flex;
    align-items: center;
    .title-icon {
      width: 24px;
      height: 24px;
    }
    .title {
      font-size: 20px;
      font-weight: bold;
      margin: 0 8px;
    }
  }
  .right-action-area {
    display: flex;
    align-items: center;
  }
  button + button {
    margin-left: 8px;
  }
}
</style>
